/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package project2;


/**
 *
 * @author rr
 */
public abstract class Constraint {
    
    
    
    public boolean[] check(int[] assignments){
        boolean[] isValid=new boolean[assignments.length];
        
        for(int i=0;i<isValid.length;i++){
            int value=assignments[i];
            
            assignments[i]=-1; //for compatibility with old code
            isValid[i]=check(assignments,i,value);
            assignments[i]=value;
        }
        
        return isValid;
    }
    
    
    protected abstract boolean check(int[] assignments, int variableIndex, int valueIndex);
    
    
}

    